<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="Author" content="TanShenghu">
    <title>获取URL参数 组件</title>
    <link rel="stylesheet" href="http://www.tanshenghu.com/static/css/base.css">
    <script src="http://a.alipayobjects.com/??seajs/seajs/2.2.0/sea.js,jquery/jquery/1.8.2/jquery.js"></script>
    <script>
    seajs.config({
      paths: {
            host: 'http://www.tanshenghu.com',
            widget: 'http://www.tanshenghu.com/widget'
        },
        alias: {
            $: 'host/static/js/$',
            getRequest: 'widget/getRequest/1.0.0/getRequest'
        }
    });
    </script>
</head>
<body>
    
    <script>
    seajs.use('getRequest', function( GetRequest ){
        
        var id = GetRequest()['id'];
        alert( id ? '当前页面参数id:'+id:'当前页面没有参数!' );
        
        id || setTimeout(function(){
            location.href = location.pathname+'?id=004725'
        }, 1000)
        
        
    });
    </script>
</body>
</html>